Expr Node

The Math Expression Node (Expr) allows the entry of a textual mathematical expression, like 2*x + y + z. The node creates an input for each variable and a single output for the result of the expression.

It has a variety of uses, including: unit conversion, control-signal mapping, wave-shaping or building custom oscillators. It can also be used when doing math with individual nodes is too cumbersome.

The Math Expression Node includes the following operators and functions:

Operators

(x) parenthetical grouping
-x negation
x^y exponentiation: xy
x * y, x / y multiplication, division
x + y, x - y addition, subtraction
x < y, x > y less, greater. 1 if true, 0 if false
x == y equality. 1 if true, 0 if false
x ? a : b conditional. b if x is 0, otherwise a

Functions

Trigonometric functions (angles are in radians)

sin(angle) sine
cos(angle) cosine
tan(angle) tangent
asin(x) arc sine
acos(x) arc cosing
atan(x) arc tangent

Exponential functions

pow(x,y) xy. Can also use x^y as shorthand.
exp(x) ex. Can also use e^x as shorthand.
ln(x) ln
log2(x) log2x
log10(x) log10x
exp2(x) 2x. Can also use 2^x as shorthand.
sqrt(x) square root

Common functions

abs(x) absolute value
floor(x) rounds down to the nearest integer
ceil(x) rounds up to the nearest integer
fract(x) x - floor(x)
mod(x,y) remainder of x / y
min(x,y) returns the lesser of x and y
max(x,y) returns the greater of x and y
clamp(x,a,b) restricts x to the interval [a, b]
step(x, edge) 1 if x > edge, otherwise 0. Hard step.
smoothstep(x, a, b) smooth step from 0 to 1 on the interval [a, b]